// Copyright (c)  YISH. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Threading.Tasks;
using Microsoft.JSInterop;
using NSQL.Parser;

namespace NSQL.WebAssembly
{
    public class Invoke
    {
        [JSInvokable]
        public static string TranslateToSql(string sql)
        {
            return SqlParser.TranslateToSql(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToSqlAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToSql(sql));
        }

        [JSInvokable]
        public static string TranslateToNpgsql(string sql)
        {
            return SqlParser.TranslateToNpgsql(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToNpgsqlAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToNpgsql(sql));
        }

        [JSInvokable]
        public static string TranslateToOracle(string sql)
        {
            return SqlParser.TranslateToOracle(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToOracleAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToOracle(sql));
        }

        [JSInvokable]
        public static string TranslateToMySql(string sql)
        {
            return SqlParser.TranslateToMySql(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToMySqlAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToMySql(sql));
        }

        [JSInvokable]
        public static string TranslateToSqlServer(string sql)
        {
            return SqlParser.TranslateToSqlServer(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToSqlServerAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToSqlServer(sql));
        }

        [JSInvokable]
        public static string TranslateToSQLite(string sql)
        {
            return SqlParser.TranslateToSQLite(sql);
        }

        [JSInvokable]
        public static Task<string> TranslateToSQLiteAsync(string sql)
        {
            return Task.Run(() => SqlParser.TranslateToSQLite(sql));
        }
    }
}